package kr.hkit.powerjava.chapter12.submit;

//프로그래밍 5번 3차원 도형 하위클래스

class Shpere extends ThreeDimShape {
	double radius ;
	
	public Shpere(double radius) {
		this.radius = radius;
	}

	@Override
	public void getVolume() {
		System.out.println("구의 부피는 " + 4 / 3 * PI * radius * radius * radius
				+ "입니다.");
	}
}

class Cube extends ThreeDimShape {
	double width ;
	double length ;
	double height ;
	
	public Cube(double width, double length, double height) {
		this.width = width;
		this.length = length;
		this.height = height;
	}

	@Override
	public void getVolume() {
		System.out.println("직육면체의 부피는 " + width * length * height + "입니다.");
	}
}

class Cylinder extends ThreeDimShape {
	double height ;
	double radius ;

	public Cylinder(double height, double radius) {
		this.height = height;
		this.radius = radius;
	}

	@Override
	public void getVolume() {
		System.out.println("원기둥의 부피는 " + (4 / 3 * PI * radius * radius * radius)
				* height + "입니다.");
	}
}
